package com.itheima.jdk8date;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/*
jdk8日期格式化及解析
 */
public class Demo02 {


    public static void main(String[] args) {
        //jiexi();

        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String format = now.format(formatter);
        System.out.println(format);


    }
    public static void jiexi() {
        String s="2048-12-13 15:16:55";

        DateTimeFormatter fommatter=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime dateTime=LocalDateTime.parse(s,fommatter);
        System.out.println(dateTime);
    }
}
